package com.xiaolei48.service.impl;

import com.xiaolei48.entity.Foods;
import com.xiaolei48.mapper.FoodsMapper;
import com.xiaolei48.service.FoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FoodsServiceImpl implements FoodsService {

    @Autowired
    private FoodsMapper foodsMapper;

    @Override
    public boolean doAddFoodsInfo(Foods foods) {
        int result = foodsMapper.insert(foods);
        return result > 0;
    }


    @Override
    public boolean doModifyFoodsInfo(Foods foods) {
        int result = foodsMapper.update(foods);
        return result > 0;
    }

    @Override
    public boolean doDeleteFoodsInfo(Foods foods) {
        int result = foodsMapper.delete(foods);
        return result > 0;
    }

    @Override
    public Foods doGetFoodsInfo(Foods foods) {
        return foodsMapper.select(foods);
    }

    @Override
    public List<Foods> doGetFoodsInfoList() {
        return foodsMapper.selectAll();
    }

    @Override
    public List<Foods> doQueryFoodsInfoList(Foods foods) {
        return foodsMapper.query(foods);
    }
}